/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package elaborate.h2x.transform.position.schema.state;

import java.util.ArrayList;
import java.util.List;
import juixb.schema.SchemaNode;

/**
 *
 * @author lendle
 */
public class StateParsers {

    protected List<StateParser> stateParsers = new ArrayList<StateParser>();

    /**
     * Get the value of stateParsers
     *
     * @return the value of stateParsers
     */
    public List<StateParser> getStateParsers() {
        return new ArrayList<StateParser>(stateParsers);
    }

    /**
     * Set the value of stateParsers
     *
     * @param stateParsers new value of stateParsers
     */
    public void setStateParsers(List<StateParser> stateParsers) {
        this.stateParsers.clear();
        this.stateParsers.addAll(stateParsers);
    }
    
    public State parseState(SchemaNode schemaNode){
        for(StateParser parser : this.stateParsers){
            if(parser.isApplicable(schemaNode)){
                return parser.parseState(this, schemaNode);
            }
        }
        return null;
    }
}
